<?php

/**
 * Ragtek Logger, creates a logfile which can be used to log messages,
 * and other "important stuff, it's nice for debugging;)
 *
 * @copyright ragtek
 * @version 1.0.1
 * @package Ragtek/Helper
 */
class Ragtek_Helper_Log extends Ragtek_Helper_Abstract{
    /**
     * @var Zend_Log
     */
    private $logger = null;
    /**
     * @var Zend_Log_Writer_Stream
     */
    private $writer = null;


    public function __construct($path = '') {

         if ($path == '') {
                $path = XenForo_Autoloader::getInstance()->getRootDir() . '\Ragtek\log.txt';
        }
        $this->writer = new Zend_Log_Writer_Stream($path);
        $this->logger = new Zend_Log($this->writer);
    }

    
    /**
     * Log a message
     *
     * @param  string   $message   Message to log
     * @param  integer  $priority  Priority of message
     * @return void
     * @throws Zend_Log_Exception
     */
    public function log($message, $do = 'log', $priority = Zend_Log::INFO, $extras = null) {
        $this->logger->$do($message, $priority, $extras);
    }
}